package sk.tuke.constraintbuilder.builder.resourcemodel;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Brano
 * Date: 16.4.2011
 * Time: 17:46
 */
public abstract class ContainerElement extends Element{
    protected List<Element> elements;

    protected ContainerElement() {
        elements = new ArrayList<Element>();
    }

    public void addElement(Element element) {
        elements.add(element);
    }
    
    public List<Element> getElements(){
    	return this.elements;
    }
    
    public void addElements(List<Element> elements){
    	this.elements.addAll(elements);
    }

    protected String generateXMLSubElements() {
        StringBuilder sb = new StringBuilder(1000);
        sb.append("");

        for (Element element : elements) {
            sb.append(element.generateXML());
        }

        return sb.toString();
    }
}
